package top.zhangjianyong.blog.params.comment;

import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;

/**
 * 加载更多子评论参数
 *
 * @author zhangjianyong
 * @since 2024/12/19
 */
public record LoadMoreChildrenParam(
    @NotNull(message = "父评论ID不能为空") Long parentId,
    @Min(value = 0, message = "偏移量不能小于0") Integer offset,
    @Min(value = 1, message = "数量不能小于1") @Max(value = 20, message = "数量不能超过20") Integer limit) {
  public LoadMoreChildrenParam {
    if (offset == null) offset = 0;
    if (limit == null) limit = 5;
  }
}
